<template>
  <view class="flex-col page">
    <view class="flex-col flex-auto group_2">
      <view class="flex-row justify-between items-center group_3">
        <text class="font_3">实验室名称</text>
        <view class="flex-row items-center space-x-4">
          <text class="font_1">{{nickname}}的实验室</text>
          <image class="shrink-0 image_6" src="../../static/images/e2fdb5f553f6a8194890627895ea7df6.png" />
        </view>
      </view>
      <view class="flex-row justify-between items-center section">
        <text class="font_3">实验室位置</text>
        <view class="flex-row space-x-36">
          <text class="font_1">南京</text>
          <!-- <image class="shrink-0 image_6" src="../../static/images/e2fdb5f553f6a8194890627895ea7df6.png" /> -->
        </view>
      </view>
      <view class="flex-row justify-between group_4">
        <text class="self-center font_3">全部设备数量</text>
        <view class="flex-row self-start space-x-24">
          <text class="font_1">{{equips.length}}个设备</text>
          <image class="shrink-0 image_6" src="../../static/images/e2fdb5f553f6a8194890627895ea7df6.png" />
        </view>
      </view>
      <view class="flex-row justify-between items-center section_2" @click="navTo('/pages/roomsguanli/roomsguanli')">
        <text class="font_3 text_5">房间管理</text>
        <view class="flex-row items-center space-x-26">
          <text class="font_1">{{rooms.length}}个房间</text>
          <image class="shrink-0 image_6" src="../../static/images/e2fdb5f553f6a8194890627895ea7df6.png" />
        </view>
      </view>
      <view class="divider"></view>
      <view class="flex-col group_5">
        <view class="flex-row justify-between">
          <text class="self-center font_3">终端设备管理</text>
          <image class="self-start image_6 image_7" src="../../static/images/e2fdb5f553f6a8194890627895ea7df6.png" />
        </view>
        <view class="flex-row justify-between items-center group_6">
          <text class="font_3">终端家庭屏保</text>
          <image class="image_6" src="../../static/images/e2fdb5f553f6a8194890627895ea7df6.png" />
        </view>
        <view class="flex-row justify-between items-center group_7">
          <text class="font_3">家庭壁纸</text>
          <image class="image_6" src="../../static/images/e2fdb5f553f6a8194890627895ea7df6.png" />
        </view>
      </view>
    </view>
  </view>
</template>

<script>
	//获取账号信息接口
	import { _getuserinfo } from '@/service/user.js'
	//获取用户所有房间列表接口
	import { _getrooms } from '@/service/room.js'
	//获取用户绑定设备列表接口
	import { _getequiplist } from '@/service/equip.js'
	//获取用户绑定的设备列表(绑定加共享)
	import { _getequiplistall } from '@/service/equip.js'
	//查询该用户得到的所有共享设备接口
	import { _getsharingequips } from '@/service/sharingequip.js'
  export default {
    components: {},
    data() {
      return {
		  nickname:'',
		  account_user:'',
		  password_user:'',
		  rooms:[],
		  equips:[]
	  };
    },
	onLoad(){
		let newdata;
		try {
			const value = uni.getStorageSync('userInfo');
			if (value != null) {
				this.nickname = value.nickname
				this.account_user = value.accountNum
				this.password_user = value.password
			}
		} catch (e) {
			console.error(e);
		}
	},
	onShow() {
		this.getrooms();
		this.getequipsinfo();
	},
    methods: {
		navTo(url){
			uni.navigateTo({
				url:url,
				success(res) {
					console.log('成功啦',res);
				},
				fail(err) {
					console.log('失败啦',err);
				}
			})
		},
		async getrooms(){
			let data={
				account_user:this.account_user
			}
			let res = await _getrooms(data);
			this.rooms = res.data;
			console.log(this.rooms);
		},
		async getequipsinfo(){
			let data={
				account_user:this.account_user
			}
			let res = await _getequiplistall(data)
			this.equips = res.data
			console.log(this.equips)
		}
	},
  };
</script>

<style scoped lang="scss">
  .page {
    background-color: #ffffff;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    .group_2 {
      padding-bottom: 133.33rpx;
      overflow-y: auto;
      .group_3 {
        padding: 45.83rpx 27.08rpx 41.67rpx 50rpx;
        .space-x-4 {
          & > view:not(:first-child),
          & > text:not(:first-child),
          & > image:not(:first-child) {
            margin-left: 8.33rpx;
          }
        }
      }
      .section {
        padding: 41.67rpx 27.08rpx 41.67rpx 50rpx;
        background-color: #ffffff;
        .space-x-36 {
          & > view:not(:first-child),
          & > text:not(:first-child),
          & > image:not(:first-child) {
            margin-left: 75rpx;
          }
        }
      }
      .font_3 {
        font-size: 35.42rpx;
        font-family: SourceHanSansCN;
        line-height: 33.33rpx;
        color: #000000;
      }
      .font_1 {
        font-size: 25rpx;
        font-family: SourceHanSansCN;
        line-height: 22.92rpx;
        color: #808080;
      }
      .image_6 {
        width: 14.58rpx;
        height: 25rpx;
      }
      .group_4 {
        padding: 39.58rpx 27.08rpx 62.5rpx 50rpx;
        border-bottom: solid 2.08rpx #a6a6a6;
        .space-x-24 {
          & > view:not(:first-child),
          & > text:not(:first-child),
          & > image:not(:first-child) {
            margin-left: 50rpx;
          }
        }
      }
      .section_2 {
        margin-top: 62.5rpx;
        padding: 45.83rpx 27.08rpx 41.67rpx 50rpx;
        background-color: #ffffff;
        .text_5 {
          line-height: 32.29rpx;
        }
        .space-x-26 {
          & > view:not(:first-child),
          & > text:not(:first-child),
          & > image:not(:first-child) {
            margin-left: 54.17rpx;
          }
        }
      }
      .divider {
        margin-top: 75rpx;
        background-color: #a6a6a6;
        height: 2.08rpx;
      }
      .group_5 {
        margin-top: 66.67rpx;
        padding-left: 50rpx;
        padding-right: 27.08rpx;
        .image_7 {
          margin-top: 12.5rpx;
        }
        .group_6 {
          margin-top: 79.17rpx;
        }
        .group_7 {
          margin-top: 145.83rpx;
        }
      }
    }
  }
</style>
